package com.jeethink.role.controller;

import java.util.List;

import com.jeethink.common.core.web.controller.BaseController;
import com.jeethink.common.core.web.domain.AjaxResult;
import com.jeethink.common.core.web.page.TableDataInfo;
import com.jeethink.common.log.annotation.Log;
import com.jeethink.common.log.enums.BusinessType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;

import com.jeethink.role.domain.ArgRole;
import com.jeethink.role.service.IArgRoleService;


/**
 * 【请填写功能名称】Controller
 * 
 * @author jeethink
 * @date 2020-10-14
 */
@RestController
@RequestMapping("/role")
public class ArgRoleController extends BaseController
{
    @Autowired
    private IArgRoleService argRoleService;

    /**
     * 新增【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('role:role:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ArgRole argRole)
    {
        return toAjax(argRoleService.insertArgRole(argRole));
    }
    /**
     * 查询【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('role:role:list')")
    @GetMapping("/list")
    public TableDataInfo list(ArgRole argRole)
    {
        startPage();
        List<ArgRole> list = argRoleService.selectArgRoleList(argRole);
        return getDataTable(list);
    }
    /**
     * 获取【请填写功能名称】详细信息
     */
    @PreAuthorize("@ss.hasPermi('role:role:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(argRoleService.selectArgRoleById(id));
    }
    /**
     * 删除【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('role:role:remove')")
    @DeleteMapping("/{id}")
    public AjaxResult delbyid(@PathVariable("id")Long id)
    {

        return toAjax(argRoleService.delbyid(id));
    }
    /**
     * 修改【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('role:role:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ArgRole argRole)
    {
        return toAjax(argRoleService.updateArgRole(argRole));
    }

}
